MAX_HOLD block

Short summary

Name

MAX_HOLD

→POU type

→function block

Category

IEC-block, SelectEnh

Conform to →IEC-standard

(plus) not defined in IEC-standard

Graphical interface

Available since

version 1.43.0 (for Neuron Power Engineer)

Functionality

The block is a peak detector which sets the output OUT to the maximum value assigned to the input IN. Setting the input R to the value TRUE (or an equivalent) resets the output value OUT to the current input value IN.

Restrictions

The following restrictions apply to the usage of overloadable function block instances:

  • The declaration is limited to local variables.

  • The usage as array base type is not allowed.

  • The usage as structure element is not allowed.

  • Instance data cannot be displayed in the Values of Variables view.

In-/outputs

 

Identifier

→Data type

Description

Inputs:

IN

REALLREALUSINTUINTUDINTULINTSINTINTDINT or LINT
(corresponds to →generic data type ANY_NUM)

input value

R

BOOL

reset

Outputs:

OUT

REALLREALUSINTUINTUDINTULINTSINTINTDINT or LINT
(corresponds to →generic data type ANY_NUM)

maximum value

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

FUNCTION_BLOCK ExampleMaxHold
    VAR
        iMaxHold : MAX_HOLD;
        inputValues : ARRAY[1..3] OF INT := [1,10,5];
        resultValues : ARRAY[1..3] OF INT;
        index : INT;
    END_VAR
      
    iMaxHold(IN:=0, R:=TRUE);    // Reset 'OUT' to '0'.
        
    FOR index := 1 TO 3 DO
        iMaxHold(IN:=inputValues[index], R := FALSE, OUT => resultValues[index]);  
    END_FOR;
      
    // 'resultValues' evaluates to '[1,10,10]'.
    ENO := AND (resultValues[1] = 1, resultValues[2] = 10, resultValues[3] = 10); 
END_FUNCTION_BLOCK

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.